﻿using ML.Utils.resource;

namespace ML.Utils
{
    /// <summary>
    /// 封装Messages_CN资源文件,使其改动就能够处理语言信息
    /// </summary>
    public static class SystemUtil
    {
        /// <summary>
        /// 根据statuscode返回查询到的汉字信息并且提交给前台
        /// </summary>
        /// <param name="statuscode">标识符</param>
        /// <returns></returns>
        public static string getMessage(int statuscode)
        {
            string result = Messages_CN.OK;
            switch (statuscode)
            {
                //系统错误(1000以内)
                case 200:
                    result = Messages_CN.OK;
                    break;
                case 201:
                    result = Messages_CN.Error;
                    break;
                case 202:
                    result = Messages_CN.Empty;
                    break;
                case 400:
                    result = Messages_CN.NoAddress;
                    break;
                case 500:
                    result = Messages_CN.ServerData;
                    break;
                case 301:
                    result = Messages_CN.NoLogin;
                    break;
                case 800:
                    result = Messages_CN.ParrNoPass;
                    break;

                //用户错误信息
                case 1000:
                    result = Messages_CN.UserPwdNoError;
                    break;
                case 1001:
                    result = Messages_CN.UserNoExist;
                    break;
                case 1003:
                    result = Messages_CN.UserDelete;
                    break;
                case 1004:
                    result = Messages_CN.ImageNoExtision;
                    break;
                case 1005:
                    result = Messages_CN.UserExistMerchant;
                    break;
                case 1006:
                    result = Messages_CN.UserExistOrder;
                    break;

                //商户
                case 1050:
                    result = Messages_CN.PlatFormExistMerchant;
                    break;
                case 1051:
                    result = Messages_CN.MerchantExistOrder;
                    break;
                case 1052:
                    result = Messages_CN.CategoryExistProduct;
                    break;
                case 1053:
                    result = Messages_CN.MerchantExist;
                    break;

                // 产品错误信息
                case 1080:
                    result = Messages_CN.ProductExistOrder;
                    break;

                //结算错误信息
                case 2000:
                    result = Messages_CN.NoUpdateSettlement;
                    break;
                case 2001:
                    result=Messages_CN.NoSettleMent;
                    break;

                //订单错误信息
                case 3000:
                    result = Messages_CN.OrderNoFind;
                    break;
                case 3001:
                    result = Messages_CN.OrderPayError;
                    break;

                default:
                    result = Messages_CN.NoError;
                    break;
            }
            return result;
        }
    }
}